import Vue from 'vue';
import VueRouter from 'vue-router';
import Login from './pages/Login.vue';
import Reg from './pages/Reg.vue';
import Main from './pages/Main.vue';
import NotFound from './pages/NotFound.vue';
import Goods from './pages/Goods.vue';
import Person from './pages/Person.vue';
Vue.use(VueRouter);
//试一试
export const router = new VueRouter({
    mode: "history",

    routes: [
        //path  页面的路径名称  component 当前路由要渲染的组件 redirect 重定向
        { path: "/", redirect: "/login" },
        { path: "/login", component: Login },
        { path: "/reg/:params?", component: Reg },
        {
            path: "/main", component: Main,
            children:[
                {path:"goods",component:Goods},
                {path:"Person",component:Person}
            ]
        },
        //当上面的所有路由都没有被匹配的时候，会匹配*，从而渲染NotFound组件
        { path: "*", component: NotFound },

    ]
})